﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WebUI.Models;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace WebUI.Areas.Reports.Models
{
    public class SpanViewModel : BaseModel
    {
        [Required]
        [RegularExpression("^1[0-9]|[1-9]+$", ErrorMessage = "Please enter correct value")]
        public int? Value { get; set; }

        [Required]
        [Range(2, 5, ErrorMessage = "Please enter correct span")]
        public int Span { get; set; }

        public FilesModel filesModel { get; set; }

        public override IEnumerable<SelectListItem> Spans
        {
            get
            {
                return base.Spans.Where(e => int.Parse(e.Value) >= 2);
            }
        }
    }
}